﻿using AiShow.BLL;
using AiShow.IBLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace AiShow.WebSite
{
    /// <summary>
    /// VideoLikeHandler 的摘要说明
    /// </summary>
    public class VideoLikeHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            var req = context.Request;
            var videoId = req.QueryString["videoId"];
            var userId =Convert.ToInt32( req.QueryString["userId"]);
            var action = req.QueryString["action"];
            ILikeManager like = new LikeManager();
            if (action=="add")
            {
                like.AddLike(videoId,userId);
            }
            else if(action == "remove")
            {
                like.RemoveLike(videoId, userId);
            }

            //context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");
            context.Response.End();
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}